﻿@model Fap.AspNetCore.ViewModel.MultiJqGridViewModel
@using Fap.AspNetCore.Controls.JqGrid
@{
    Column column = new Column("oper");
    column.SetLabel("打分");
    column.SetSortable(false);
    column.SetWidth(80);
    var scoreModel = Model.JqGridViewModels["score"];
    var resultModel = Model.JqGridViewModels["result"];
}
<title>
    <fap-multilang lang-key="my_assess_score" default-content="考核打分"></fap-multilang>
</title>
<script>
    function initAssessTodoMenu() {
        var ids = $("#grid-myscore").jqGrid('getDataIDs');
        for (var i = 0; i < ids.length; i++) {
            var de = '';
            var cl = ids[i];
            var rd = jQuery('#grid-myscore').jqGrid('getRowData', cl);
            var fid = rd.Fid;
            var schemeUid = rd.ProgramUid;
            var objectUid = rd.ObjectUid;
            de += "<a  href='javascript:void(0)' onclick='showAssessTodo(\"" + fid + "\",\"" + schemeUid + "\",\"" + objectUid + "\")'>" + $.lang("score", "打分") + "</a>  ";

            jQuery('#grid-myscore').jqGrid('setRowData', ids[i], { oper: de });
        }
    }
    function showAssessTodo(fid, schemeUid, objectUid) {
        bootboxWindow($.lang("score", "打分"), basePath + "/Assess/Manage/Scoring", {
            add: {
                label: $.lang("ok", "确定"),
                className: "btn-primary btn-link",
                callback: function () {
                    var scores = saveScore(fid, schemeUid, objectUid);
                    $.post(basePath + "/Assess/Api/Score", { scores: scores }, function (rv) {
                        if (rv.success) {
                            $.msg(rv.msg);
                            refreshGrid("grid-myscore");
                        } else {
                            bootbox.alert(rv.msg);
                        }
                    })
                    return false;
                }
            }
        }, { examinerUid: fid, schemeUid: schemeUid });
    }
</script>
<div class="row">
    <div class="col-xs-12">
        <!-- #section:elements.tab -->
        <div class="tabbable" id="myTab">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a data-toggle="tab" href="#scoring">
                        <i class="green ace-icon fa fa-bars bigger-120"></i>
                        <fap-multilang default-content="待打分" lang-key="scoring"></fap-multilang>
                    </a>
                </li>

                <li>
                    <a data-toggle="tab" href="#result">
                        <i class="green ace-icon fa fa-gavel  bigger-120"></i>
                        <fap-multilang default-content="考核结果" lang-key="assess_result"></fap-multilang>
                    </a>
                </li>

            </ul>

            <div class="tab-content">
                <div id="scoring" class="tab-pane fade in active">
                    <fap-grid id="myscore" attach-column="column" grid-model="scoreModel" on-grid-complete="initAssessTodoMenu" shrink-fit="false" wrapper="myTab,scoring" register-authority="false"></fap-grid>
                </div>

                <div id="result" class="tab-pane fade">
                    <fap-grid id="assessresult" grid-model="resultModel" auto-width="true" wrapper="myTab,result" register-authority="false" shrink-fit="false" view-records="true"></fap-grid>
                </div>

            </div>
        </div>

    </div>
</div>
<script>

    var scripts = [null, null];
    $('.page-content-area').ace_ajax('loadScripts', scripts, function () {
        jQuery(function ($) {
            $(document).one('ajaxloadstart.page', function (e) {

            })

        })

    })
</script>



